﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

namespace Hyunhdai_Saigon_Project.uc
{
    public partial class uc_baiviet : System.Web.UI.UserControl
    {
        private String sql;
        private String id;
        protected void Page_Load(object sender, EventArgs e)
        {
            id = Request.QueryString.Get("id");
            sql = "select * from articles where id = " + id;
           
                bindData();
        }
        protected void bindData()
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["hyundaisaigonConnectionString"].ConnectionString);
            connection.Open();
            SqlDataAdapter da = new SqlDataAdapter(sql, connection);
            DataTable dt = new DataTable();
            da.Fill(dt);
            string title = dt.Rows[0][2].ToString();
            string introtext = dt.Rows[0][3].ToString();
            string ftext = dt.Rows[0][4].ToString();
            string img = dt.Rows[0][5].ToString();
            string date = dt.Rows[0][6].ToString();
            lblTitle.Text = title;
            lblIntroText.Text = introtext;
            lblFText.Text = ftext;
            lbldate.Text = date;
            Image1.ImageUrl = img;
            connection.Close();
        }
      
    }
}